﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.DirectX;
using SimulationCore.Net;

namespace SimulationPresenter.Simulation.Primitive
{
    internal class MetalCloth : ISimulationPrimitive, ICloth
    {
        /// <summary>
        /// Specifies base name for cloth
        /// </summary>
        public string Name
        {
            get; set;
        }

        /// <summary>
        /// Mesh grid
        /// </summary>
        public IndexedVectorGrid Grid
        {
            get;
            set;
        }

        /// <summary>
        /// Defines initial Impulse Threshold for deformation reaction
        /// </summary>
        public float ImpulseThreshold
        {
            get; set;
        }

        /// <summary>
        /// Defines maximum Penetration Depth of a deformation
        /// </summary>
        public float PenetrationDepth
        {
            get; set;
        }

        public Matrix Transformation
        {
            get;
            set;
        }
        
        public ISimulationPrimitive PutOrUpdate(SimulationEnvironment enviroment)
        {
            enviroment.Core.CreateMetalCloth(Name, Transformation, ImpulseThreshold, PenetrationDepth, Grid.Vertexes, Grid.Indices);
            return this;
        }

        internal const float defaultPenetrationDepth = 10.0f;
        internal const float defaultImpulseThreshold = 0.1f;
    }
}
